<HTML>
<HEAD>
<TITLE></TITLE>

<style>
</style>
</HEAD>

<BODY>

<table border="4"><tr><td>
<embed src="phystickman.swf" width="640" height="480" type= "application/x-shockwave-flash" />
</td>
<td>

<p>
Based on this 
<a href="http://ncannasse.fr/blog/one_physaxe_example">demo</a>
add some very simple "joints" sufficient for stickman style action.
</p>

<p>
Click to add more bodies to the world.
</p>

<p>
Usage is something like:
</p>

<pre>
var a = body( 50, 40 );
var b = body( 50, 140 );
var j = new DistanceJoint( a, b );

world.addBody( a );
world.addBody( b );
world.addJoint( j );
</pre>

<p>
It is not integrated right, cuz I had to loop over my joints when I stepped the world.
The interesting piece of the "DistanceJoint" look like this:
</p>

<pre>

public override function preStep( invDt : Float ) {
	var currentDistance = dist( b1, b2 );
	if ( 0 != currentDistance ) {

		var diff = ( currentDistance - this.distance ) / currentDistance;
		var xdiff = ( b2.x - b1.x ) * diff;
		var ydiff = ( b2.y - b1.y ) * diff;

		b1.v.x += xdiff * 0.5;
		b2.v.x -= xdiff * 0.5;

		b1.v.y += ydiff * 0.5;
		b2.v.y -= ydiff * 0.5;
	}
}
</pre>
</td>
</tr></table>

</BODY>
</HTML>
